0) $_SESSION['ref'] = intval($_GET['ref']); } } // Record referrer's user id in new user meta function was_record_referrer($user_id) { update_user_meta($user_id, '_user_referrer', $_SESSION['ref']); } function enqueue_styles() { wp_enqueue_style( 'biodon-style', get_stylesheet_uri()); } add_action('wp_enqueue_scripts', 'enqueue_styles'); function disable_emojis() { remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); remove_action( 'wp_print_styles', 'print_emoji_styles' ); remove_action( 'admin_print_styles', 'print_emoji_styles' ); remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); remove_action('wp_head', 'wp_generator'); add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' ); add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 ); } add_action( 'init', 'disable_emojis' ); /** * Filter function used to remove the tinymce emoji plugin. * * @param array $plugins * @return array Difference betwen the two arrays */ function disable_emojis_tinymce( $plugins ) { if ( is_array( $plugins ) ) { return array_diff( $plugins, array( 'wpemoji' ) ); } else { return array(); } } /** * Remove emoji CDN hostname from DNS prefetching hints. * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed for. * @return array Difference betwen the two arrays. */ function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) { if ( 'dns-prefetch' == $relation_type ) { /** This filter is documented in wp-includes/formatting.php */ $emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' ); $urls = array_diff( $urls, array( $emoji_svg_url ) ); } return $urls; } function wph_noadmin() { if (is_admin() && !current_user_can('administrator')) { wp_redirect(home_url()); exit; } } add_action('init', 'wph_noadmin'); add_filter( 'gettext', 'register_text' ); add_filter( 'ngettext', 'register_text' ); function register_text( $translating ) { $translated = str_ireplace( 'Имя пользователя или e-mail', 'E-mail (электронная почта)', $translating ); return $translated; } if ($pagenow=='wp-login.php') { add_filter( 'gettext', 'user_email_login_text', 20, 3 ); function user_email_login_text( $translated_text, $text, $domain ){ if ($translated_text == 'E-mail') { $translated_text = 'E-mail (обязательно)'; } if ($translated_text == 'Имя пользователя') { $translated_text = 'Ник (латинскими буквами)'; } return $translated_text; } } add_filter( 'widget_meta_poweredby', '__return_empty_string' ); function wpdocs_excerpt_more( $more ) { return ' >>> далее...'; } add_filter( 'excerpt_more', 'wpdocs_excerpt_more' ); add_filter('xmlrpc_enabled', '__return_false'); // Отключение rss ленты function fb_disable_feed() { wp_redirect(get_option('siteurl')); } add_action('do_feed', 'fb_disable_feed', 1); add_action('do_feed_rdf', 'fb_disable_feed', 1); add_action('do_feed_rss', 'fb_disable_feed', 1); add_action('do_feed_rss2', 'fb_disable_feed', 1); add_action('do_feed_atom', 'fb_disable_feed', 1); remove_action( 'wp_head', 'feed_links_extra', 3 ); remove_action( 'wp_head', 'feed_links', 2 ); remove_action( 'wp_head', 'rsd_link' ); if ( ! function_exists( 'example_setup' ) ) : function mythemename_theme_setup() { // добавление миниатюры поста add_theme_support( 'post-thumbnails' ); // какие форматы постов будут поддерживаться add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status', ) ); } endif; add_action( 'after_setup_theme', 'mythemename_theme_setup' ); /*============================================= BREADCRUMBS =============================================*/ // to include in functions.php function the_breadcrumb() { $showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show $delimiter = '»'; // delimiter between crumbs $home = 'Главная'; // text for the 'Home' link $showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb global $post; $homeLink = get_bloginfo('url'); if (is_front_page()) { } elseif (is_home()) { echo '
' . $home . ' ' . $delimiter . ' Новости и акции
'; } else { echo '
' . $home . ' ' . $delimiter . ' '; if (is_category()) { $thisCat = get_category(get_query_var('cat'), false); if ($thisCat->parent != 0) { echo get_category_parents($thisCat->parent, true, ' ' . $delimiter . ' '); } echo $before . 'Записи по категории "' . single_cat_title('', false) . '"' . $after; } elseif (is_single() && !is_attachment()) { if (get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '' . $post_type->labels->singular_name . ''; if ($showCurrent == 1) { echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } } else { $cat = get_the_category(); $cat = $cat[0]; $cats = get_category_parents($cat, true, ' ' . $delimiter . ' '); if ($showCurrent == 0) { $cats = preg_replace("#^(.+)\s$delimiter\s$#", "$1", $cats); } echo $cats; if ($showCurrent == 1) { echo $before . get_the_title() . $after; } } } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } elseif (is_attachment()) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, true, ' ' . $delimiter . ' '); echo '' . $parent->post_title . ''; if ($showCurrent == 1) { echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } } elseif (is_page() && !$post->post_parent) { if ($showCurrent == 1) { echo $before . get_the_title() . $after; } } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '' . get_the_title($page->ID) . ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); for ($i = 0; $i < count($breadcrumbs); $i++) { echo $breadcrumbs[$i]; if ($i != count($breadcrumbs)-1) { echo ' ' . $delimiter . ' '; } } if ($showCurrent == 1) { echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } } elseif (is_404()) { echo $before . 'Ошибка 404' . $after; } if (get_query_var('paged')) { if (is_category()) { echo ' ('; } echo __('Page') . ' ' . get_query_var('paged'); if (is_category()) { echo ')'; } } echo '
'; } } // end the_breadcrumb() function my_404_noindex () { if (is_404()) { echo "".''."\n"; } } add_action('wp_head', 'my_404_noindex', 3); function my_rel_canonical() { if (!is_404()) { // если не 404 ошибка $requested_url = ( !empty($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; $requested_url .= $_SERVER['HTTP_HOST']; $requested_url .= $_SERVER['REQUEST_URI']; $url_array = explode('?', $requested_url); $requested_url = $url_array[0]; // отсекаем все что после первого знака вопроса ? $requested_url = rtrim($requested_url, '/'); // убираем конечный слеш, если есть echo "".''."\n"; } } add_action('wp_head', 'my_rel_canonical', 3); remove_action( 'wp_head', 'wp_resource_hints', 2 ); add_action("vsz_cf7_after_insert_db","vsz_cf7_after_insert_db_callback",10,3); function vsz_cf7_after_insert_db_callback($fid,$cf7_id,$data_id){ global $wpdb, $_SESSION; $sid_id = intval($_SESSION['ref']); $wpdb->insert( 'orders', array( 'zakaz_id' => intval($data_id), 'ref_id' => $sid_id) ); session_destroy(); } add_action( 'login_head', 'ilc_custom_login'); function ilc_custom_login() { echo ' '; } add_filter('pre_wp_mail', 'templ_disable_emails'); function templ_disable_emails() { return false; } ?>